package com.hotelvip.controller;

/**
 * @Author: ypb
 * @Date: 2021/3/1 10:15
 */

import com.hotelvip.common.utils.JSONResult;
import com.hotelvip.service.StatisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 统计数据
 */
@RestController
@RequestMapping("/statistics")
@Api(basePath = "/statistics", tags = "数据统计")
public class StatisticsController {
    @Autowired
    private StatisticsService statisticsService;

    /*
     * 用户数量统计
     */
   /* @ApiOperation(value = "用户数量统计", httpMethod = "GET")
    @GetMapping("/getRetailUsers")
    public JSONResult getTotalUsers() {
        return JSONResult.ok(statisticsService.getTotalUsers());
    }*/
    /**
     * 数量统计/散户/Vip/会员卡数量/房间数/总销售资金
     */
    @ApiOperation(value = "数量统计/散户/Vip/会员卡数量/房间数/总销售资金", httpMethod = "GET")
    @GetMapping("/getRetail")
    public JSONResult getRetail() {
        return JSONResult.ok(statisticsService.getRetail());
    }

    /**
     * 查询出售卡套餐数量 每种套餐卡的每月销售统计
     * date yyyy
     */
    @ApiOperation(value = "销售会员卡统计", httpMethod = "GET")
    @GetMapping("/getVipCardsByMonth")
    public JSONResult getVipCardsByMonth(@RequestParam(value = "date",required = false)String date) {
        //userId不为空的是用户的会员卡
        return JSONResult.ok(statisticsService.getVipCardsByMonth(date));
    }
}
